<?php
namespace app\common\only\jy;

class Order extends Base {
	protected $prefix = 'jy\\Order';

	public function today_order() {
		$model = $this->getModel('jy\\Order');
		return $this->get('today_order', function($model) {
			$startTime = strtotime(date('Y-m-d 00:00:00'));
        	$endTime = strtotime(date('Y-m-d 23:59:59'));
			return $model->where('createtime', 'between', [$startTime, $endTime])->where('paytime > 0')->select();
		}, [$model]);
	}

	public function today_user_order($sid) {
		$model = $this->getModel('jy\\Order');
		return $this->get('today_order', function($model, $sid) {
			$startTime = strtotime(date('Y-m-d 00:00:00'));
        	$endTime = strtotime(date('Y-m-d 23:59:59'));
			$list = $model->where(['sid' => $sid])->where('createtime', 'between', [$startTime, $endTime])->where('paytime > 0')->select();
			return $list;
		}, [$model, $sid]);
	}
}